package demoTest;



import utils.StringUtil;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 *
 */
public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        while (((str = br.readLine()) != null)) {

            System.out.println(DD(str));
        }
    }

    public static String DD(String str){
        String[] subIP = str.split("\\.");
        if (subIP.length < 4){
            return "NO";
        }
       for(int i =0; i < subIP.length; i++){
            if (subIP[i] == null){
                return "NO";
            }
            Long intIP = Long.valueOf(subIP[i]);
            if(intIP >= 0 && intIP<=255){
                continue;
            } else{
                return "NO";
                //break;
            }
        }
        return "YES";
    }

    public static int getMaxNum(String[] arr){
        int length = arr.length;
        if (length <= 1){
            return 1;
        }
        if (Integer.parseInt(arr[length - 2]) < Integer.parseInt(arr[length - 1])){

            return getMaxNum(Arrays.copyOfRange(arr,1,arr.length - 1)) + 1;
        }else {
            return getMaxNum(Arrays.copyOfRange(arr,1,arr.length - 1));
        }
    }

    public static int[] getIndex(String[] ssArr, boolean range){
        int[] leftArr = new int[ssArr.length];

        //元素左边小于的集合
        if (range){
            for (int i = 0; i < ssArr.length; i++) {
                int leftMax = 0;
                int num = Integer.parseInt(ssArr[i]);
                leftArr[i] = 1;
                if(i == 0){
                    continue;
                }

                for (int j = 0; j < i; j++) {
                    if (num - Integer.parseInt(ssArr[j]) > 0){
                        // 小于该数的最大的 连续值
                        if (leftArr[j] > leftMax){
                            leftMax = leftArr[j];
                        }
                    }
                }
                //只需在比 比自己小的数中最大的连续值+1即可
                leftArr[i] = leftMax + 1;

            }
        }else {
            for (int i = ssArr.length-1; i >=0; i--) {
                int rightMax = 0;
                int num = Integer.parseInt(ssArr[i]);
                leftArr[i] = 1;
                if(i == ssArr.length-1){
                    continue;
                }

                for (int j = i+1; j < ssArr.length-1; j++) {
                    if (num - Integer.parseInt(ssArr[j]) > 0){
                        if (leftArr[j] > rightMax){
                            rightMax = leftArr[j];
                        }
                    }
                }

                leftArr[i] = rightMax + 1;
            }
        }
        return leftArr;
    }


    public static boolean match(String target, String str){
        if (target.equals(str)){
            return false;
        }
        if (target.length() != str.length()){
            return false;
        }
        int[] num = new int[26];
        for (int i = 0; i < target.length(); i++) {
            num[target.charAt(i) - 'a'] ++;
            num[str.charAt(i) - 'a'] --;
        }
        for (int i = 0; i < num.length; i++) {
            if (num[i] != 0){
                return false;
            }
        }
        return true;
    }

    public static int[] toIntArray(Set<Integer> set) {
        int[] r = new int[set.size()];
        Iterator<Integer> it = set.iterator();
        for (int i = 0; i < r.length; i++) {
            if (! it.hasNext()) // fewer elements than expected
                return Arrays.copyOf(r, i);
            r[i] = it.next();
        }
        return r;
    }

    public static int[] sort1(int[] values) {
        int count = 0;
        for (int i = 0; i < values.length; i++) {
            int temp = 0;
            boolean flag = true;//避免已经排好序了，还要循环

            //  左右比较，第一次循环，本案例相当于把最大的已到数组最右边了
            for (int j = 0; j < values.length - 1 - i; j++) {
                count ++;
                if(values[j] > values[j+1]) {
                    temp = values[j];
                    values[j] = values[j+1];
                    values[j+1] = temp;
                    flag = false;
                }
                //System.out.println(Arrays.toString(values));
            }
            if(flag) {
                break;
            }
        }
        return values;
    }
}
